from collections import defaultdict

# 创建一个对象，其默认值为一个包含两个空集合的元组
ai_dict = {}
size = 5  # 限制长度


# 初始化字典组
def InitDic(information_dict):
    for key in information_dict:
        ai_dict[key] = []


# 添加消息 超出限制长度后删除0
def AddAIMessage(sender, msg):
    ai_dict[sender].append(msg)
    if len(ai_dict[sender]) > size:
        ai_dict[sender].pop(0)


# 获取AI消息列表
def GetAIMessage(user):
    return ai_dict[user]
